package com.kt.globalhandler;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

//捕获全局异常
@ControllerAdvice
public class GlobalExceptionHandler {

	@ResponseBody
	@ExceptionHandler(RuntimeException.class)
	public Map<String , Object> resultError() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("errorCode",500);
		map.put("errorMsg", "系统错误");
		return map;
	}

}
